export function debounce(func: Function, wait: number) {
    let timeout: any;
    // @ts-ignore
    let _this: any = this;
    return function (...args: any[]) {
        if (timeout) {
            clearTimeout(timeout);
        }
        timeout = setTimeout(() => {
            func.apply(_this, args);
        }, wait);
    };
}
